/**
 * ======================================
 * 深度解读工单列表
 * author: admin
 * file: deep-interpretation-order.js
 * date: 2022/4/20 11:20
 * ======================================
 */
import baseClass from '@/list/baseClass'
import _ from 'lodash'
export default class DeepInterpretationOrderClass extends baseClass {
  constructor(prop) {
    super(prop)
    const userName = _.get(prop, 'userVo.userName', 'default username')
    let gender = _.get(prop, 'userVo.gender', '-')
    if (parseInt(gender) === 0) {
      gender = '女'
    }
    if (parseInt(gender) === 1) {
      gender = '男'
    }
    this.id = _.get(prop, 'id', '')
    const age = _.get(prop, 'userVo.age', '-')
    const height = _.get(prop, 'userVo.height', '-')
    const weight = _.get(prop, 'userVo.weight', '-')
    this.caseNo = _.get(prop, 'caseNo', '-')
    this.deviceId = _.get(prop, 'deviceId', '-')
    this.orgName = _.get(prop, 'orgName', '-')
    this.title = _.get(prop, 'title', '-')
    this.reportSerialNumber = _.get(prop, 'reportSerialNumber', '-')
    this.handler_name = _.get(prop, 'handler_name', '-')
    this.to_user_name = _.get(prop, 'to_user_name', '-')
    this.reportDate = _.get(prop, 'reportDate', '-')
    const recordStatue = _.get(prop, 'recordStatue', '-')
    this.recordStatue = recordStatue
    this.showStatue = _.get(prop, 'showStatue', 0)
    this.dealStatue = _.get(prop, 'dealStatue', 0)
    // UN_HANDLE(0),
    // HANDLE(1),
    // UN_SUBMIT(2),
    // CLOSED(3),
    // ALL(4);
    let statusText = ''
    switch (this.showStatue) {
      case 0:
        statusText = '未处理'
        break
      case 1:
        statusText = '已处理'
        break
      case 2:
        statusText = '已处理未提交'
        break
      case 3:
        statusText = '已处理已提交'
        break
      default:
        statusText = '未知（' + this.showStatue + ')'
    }
    this.statusText = statusText
    this.createDate = _.get(prop, 'createDate', '-')
    this.userinfo = `${userName} ${gender} ${age}岁 ${height}cm ${weight}kg `
  }
  list() {
    return [
      {
        name: '工单编号',
        key: 'caseNo',
        fixed: '',
        edit: false,
        show: true,
        value: 200
      },
      {
        name: '用户信息',
        key: 'userinfo',
        fixed: '',
        edit: false,
        show: true,
        value: 200
      },
      {
        name: '设备号',
        key: 'deviceId',
        fixed: '',
        edit: false,
        show: true,
        value: 200
      },
      {
        name: '机构',
        key: 'orgName',
        fixed: '',
        edit: false,
        show: true,
        value: 100
      },
      {
        name: '标题',
        key: 'title',
        fixed: '',
        edit: false,
        show: true,
        value: 100
      },
      {
        name: '报告编号',
        key: 'reportSerialNumber',
        fixed: '',
        edit: false,
        show: true,
        value: 200
      },
      {
        name: '已处理人',
        key: 'handler_name',
        fixed: '',
        edit: false,
        show: true,
        value: 100
      },
      {
        name: '待处理人',
        key: 'to_user_name',
        fixed: '',
        edit: false,
        show: true,
        value: 100
      },
      {
        name: '状态',
        key: 'statusText',
        fixed: '',
        edit: false,
        show: true,
        value: 100
      },
      {
        name: '创建时间',
        key: 'createDate',
        fixed: '',
        edit: false,
        show: true,
        value: 200
      },
      {
        name: '操作',
        key: 'action',
        fixed: 'right',
        edit: false,
        show: true,
        value: 110
      }
    ]
  }
}
